const Controller = require('egg').Controller;

class hjyUserController extends Controller {

    //查询用户登录信息
    async queryUser() {
        let t_user = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryUser(t_user);

        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //加载部门信息
    async queryNumDept() {

        let t_department = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryNumDept(t_department);
        this.ctx.body = {
            statuscode: 200,
            title: '加载成功',
            result
        }
    }

    //新增部门信息
    async addNewDept() {

        let t_department = this.ctx.request.body;

        let result = await this.service.hjyUserSer.addNewDept(t_department);
        this.ctx.body = {
            statuscode: 200,
            title: '新增成功',
            affectrow: result.affectedRows
        }
    }

    //修改部门信息
    async updateUser() {
        let t_department = this.ctx.request.body;
        let result = await this.service.hjyUserSer.updateUser(t_department);
        this.ctx.body = {
            statuscode: 200,
            title: '修改成功！',
            affectrow: result.affectedRows
        }
    }

    //删除部门信息
    async deleteDept() {

        let t_department = this.ctx.request.body;

        let result = await this.service.hjyUserSer.deleteDept(t_department);
        this.ctx.body = {
            statuscode: 200,
            title: '删除成功',
            affectrow: result.affectedRows
        }
    }

    //部门信息模糊查询
    async queryDept() {

        let t_department = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryDept(t_department);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //新增物资资料
    async addNewProduct() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.addNewProduct(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '新增成功',
            affectrow: result.affectedRows
        }
    }

    //修改物资资料
    async updateProduct() {
        let b_product = this.ctx.request.body;
        let result = await this.service.hjyUserSer.updateProduct(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '修改成功！',
            affectrow: result.affectedRows
        }
    }

    //物资回收
    async updateRecycle() {
        let b_product = this.ctx.request.body;
        let result = await this.service.hjyUserSer.updateRecycle(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '回收成功',
            affectrow: result.affectedRows
        }
    }

    //物资审核
    async updateAudit() {
        let b_product = this.ctx.request.body;
        let result = await this.service.hjyUserSer.updateAudit(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '审核通过',
            affectrow: result.affectedRows
        }
    }

    //查询正常物资
    async queryProduct1() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryProduct1(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //查询回收站物资
    async queryProduct0() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryProduct0(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //查询审核物资
    async queryProduct2() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryProduct2(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //物资模糊查询
    async queryProduct() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryProduct(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //物资类别查询
    async queryClass() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.queryClass(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '查询成功',
            result
        }
    }

    //删除物资资料
    async deleteProduct() {

        let b_product = this.ctx.request.body;

        let result = await this.service.hjyUserSer.deleteProduct(b_product);
        this.ctx.body = {
            statuscode: 200,
            title: '删除成功',
            affectrow: result.affectedRows
        }
    }

}

module.exports = hjyUserController;